/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.unitedats.common.Entity;


import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Awad
 */
@Entity
@Table(name = "sys_module")
@XmlRootElement
@NamedQueries({
              @NamedQuery(name = "SysModule.findAll", query = "SELECT s FROM SysModule s"),
              @NamedQuery(name = "SysModule.findById", query = "SELECT s FROM SysModule s WHERE s.id = :id"),
              @NamedQuery(name = "SysModule.findByDisplayName",
                          query = "SELECT s FROM SysModule s WHERE s.displayName = :displayName"),
              @NamedQuery(name = "SysModule.findByDisplayOrder",
                          query = "SELECT s FROM SysModule s WHERE s.displayOrder = :displayOrder")
    })
public class SysModule implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "display_name")
    private String displayName;
    @Basic(optional = false)
    @Column(name = "display_order")
    private Integer displayOrder;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "moduleId")
    private List<SysRole> sysRoleList;

    public SysModule() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public Integer getDisplayOrder() {
        return displayOrder;
    }

    public void setDisplayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
    }

    @XmlTransient
    public List<SysRole> getSysRoleList() {
        return sysRoleList;
    }

    public void setSysRoleList(List<SysRole> sysRoleList) {
        this.sysRoleList = sysRoleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SysModule)) {
            return false;
        }
        SysModule other = (SysModule) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.unitedats.common.Entity.SysModule[ id=" + id + " ]";
    }

}
